import datetime
import uuid

from django.db import models

# Create your models here.

class Users(models.Model):
    account = models.CharField(max_length=20,unique=True,verbose_name="用户账号")
    name = models.CharField(max_length=20,verbose_name="用户名")
    email = models.CharField(max_length=30,verbose_name="电子邮件")
    phone = models.CharField(max_length=15,verbose_name="手机号",null=True)
    pwd = models.CharField(max_length=200,verbose_name="密码")
    img = models.ImageField(upload_to="userpic",verbose_name="头像")
    def __str__(self):
        return self.name
    class Meta:
        db_table='users'
        verbose_name='用户'
        verbose_name_plural=verbose_name

class Cities(models.Model):
    name = models.CharField(max_length=255,verbose_name="城市名")
    score = models.IntegerField(default=0,verbose_name="城市热度")
    simplepin=models.CharField(max_length=30,verbose_name="简拼")
    allpin=models.CharField(max_length=30,verbose_name="全拼")
    class Meta:
        db_table = "cities"
        verbose_name = '城市'
        verbose_name_plural = "城市"
    def __str__(self):
        return self.name

class Navs(models.Model):
    imgsrc = models.ImageField(upload_to="citypic")
    city = models.ForeignKey(Cities,on_delete=True)
    class Meta:
        db_table = "navs"
        verbose_name = "城市轮播"
        verbose_name_plural="城市轮播"
    def __str__(self):
        return self.imgsrc

# class Houses(models.Model):
#     owner = models.ForeignKey(Users,on_delete=True)
#     name = models.CharField(max_length=255)
#     price = models.FloatField()
#     imgsrc = models.ImageField(upload_to="housepic")
#     placename = models.CharField(max_length=255)
#     lng = models.FloatField()
#     lat = models.FloatField()
#     city = models.ForeignKey(Cities, on_delete=True)
#     class Meta:
#         db_table = "houses"
#         verbose_name="房源"
#         verbose_name_plural="房源"
#
# class HouseImg(models.Model):
#     imgsrc = models.CharField(max_length=255)
#     house = models.ForeignKey(Houses,on_delete=True)
#     size = models.CharField(max_length=20)
#     class Meta:
#         db_table = "houseimgs"
#
#
#
#
# class Comments(models.Model):
#     msg = models.CharField(max_length=255)
#     user = models.ForeignKey(Users,on_delete=True)
#     house = models.ForeignKey(Houses,on_delete=True)
#     reply = models.CharField(max_length=255)
#     sendtime = models.DateTimeField(default=datetime.datetime.now())
#     class Meta:
#         db_table = "comments"
#
# class Orders(models.Model):
#     ordertime = models.DateField(default=datetime.datetime.now())
#     startroom = models.DateField()
#     ispay = models.BooleanField()
#     regtime = models.DateTimeField(default=datetime.datetime.now())
#     outtime = models.IntegerField(default=30)
#     user = models.ForeignKey(Users, on_delete=True)
#     house = models.ForeignKey(Houses, on_delete=True)
#     class Meta:
#         db_table = "orders"

